/*============================================================================
  File:      IDMAlgorithmNavigation.Stubs.cpp
 
  Summary:   IDMAlgorithmNavigation stubs to paste into implementation file
			 for class implementing the navigator

  Date:		 September 12, 2003
------------------------------------------------------------------------------
  This file is part of the Microsoft SQL Server Code Samples.
 
  Copyright (C) 2003 Microsoft Corporation.  All rights reserved.
 
This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.
 
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
============================================================================*/


////
//
// IDMDAGNavigation 
//
////

STDMETHODIMP YOUR_NAVIGATION_CLASS::MoveToNextTree(void)
{
	// Set the current node to be the root node of the next tree in the forest that
	// describes your model. Models are typically represented using a single tree. If 
	// the current tree is the last one, you return S_FALSE.

	return S_FALSE;
}

	
STDMETHODIMP YOUR_NAVIGATION_CLASS::GetNodeID(
	/* [out] */ DM_DAGNodeID*	out_pNodeID)
{
	// Set *out_pNodeID to be the current node id
	
	*out_pNodeID = (DM_DAGNodeID) -1;

	return S_OK;
}


STDMETHODIMP YOUR_NAVIGATION_CLASS::LocateNode(
	/* [in] */ DM_DAGNodeID in_NodeID)
{
	// Set the current node to be the one indicated by in_NodeID

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::ValidateNodeID(
	/* [in] */ DM_DAGNodeID in_NodeID)
{
	// Return E_FAIL if in_NodeID does not correspond to a valid node id

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetParentCount(
	/* [out] */ ULONG*	out_pulParents)
{
	// Set *out_pulParents to be the number of parents of the current node

	*out_pulParents = 0;

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::MoveToParent(
	/* [in] */ ULONG in_ParentIndex)
{
	// Change the current node to be the given parent of the 
	// current node.

	return S_OK;
}


STDMETHODIMP YOUR_NAVIGATION_CLASS::GetParentNodeID(
	/* [in] */ ULONG in_ParentIndex,
	/* [out] */ DM_DAGNodeID *out_pNodeID)
{
	// Set *out_pNodeID to be the node ID of the given parent

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetChildCount(
	/* [out] */ ULONG*	out_pulChild)
{
	// Set *out_pulChild to be the number of children of the current node

	*out_pulChild = 0;

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::MoveToChild(
	/* [in] */ ULONG in_ChildIndex)
{
	// Set the current node to be the given child of the current node

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetChildNodeID(
	/* [in] */ ULONG			in_ChildIndex,
	/* [out] */ DM_DAGNodeID*	out_pNodeID)
{
	// Set *out_pNodeID to be the node id of the given child of the current node

	*out_pNodeID = (DM_DAGNodeID) -1;

	return S_OK;
}

	
STDMETHODIMP YOUR_NAVIGATION_CLASS::MoveToNextLeaf(
	/* [in] */ DM_DAGNodeID in_ScopeNodeID)
{
	// Set the current node to be the next leaf (in an order you decide)
	// that has node in_ScopeNodeID as an ancestor. Return S_FALSE if the
	// current node is the last such leaf.

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::AddRefNodeID(
	/* [in] */ DM_DAGNodeID in_NodeID)
{
	// Called to indicate that a reference is being made to
	// a node. You must keep any per-node resources available
	// for that reference.

	return S_OK;
}


STDMETHODIMP YOUR_NAVIGATION_CLASS::ReleaseNodeID(
	/* [in] */ DM_DAGNodeID in_NodeID)
{
	// Called when a reference to the given node is released. Once
	// the ref count for a node is zero, you may release any node-specific
	// resources you allocated.

	return S_OK;
}

////
//
// IDMAlgorithmNavigation
//
////


STDMETHODIMP YOUR_NAVIGATION_CLASS::GetNodeProperty(
	/* [in] */ IDMContextServices*	in_pContext,
	/* [in] */ DM_NODE_PROP			in_PropID,
	/* [in] */ DMVariantPtr			io_pValue)
{
	// Set *io_pValue to the appropriate value, depending on the property
	// desired by the caller. If the current node does not support the given
	// property, the function should return S_FALSE.
	//
	// Following are the allowed "simple" properties, the types expected for the DMVariantPtr, 
	// and a description. The "non simple" properties (DMNP_ATTRIBUTES and DMNP_DISTRIBUTION)
	// are returned using 

	// DMNP_TYPE (ULONG)		: the "type" of the current node. The set of types currently recognized
	//							  by the server are defined (as const ULONG) in "oledbdm.h" and include:
	//
	//									DM_NODE_TYPE_MODEL        
	//									DM_NODE_TYPE_REGRESSION_TREE_ROOT         
	//									DM_NODE_TYPE_TREE_INTERIOR    
	//									DM_NODE_TYPE_DISTRIBUTION 
	//									DM_NODE_TYPE_CLUSTER      
	//									DM_NODE_TYPE_UNKNOWN      
	//
	//						  If you implement your own browser, you may define your own types
	//
	// DMNP_CONDITION_XML (BSTR) : the "condition" corresponding to the current node, in XML
	//
	// DMNP_RULE_XML (BSTR)	: the "rule" corresponding to the current node, in XML
	//
	// DMNP_PROBABILITY	(double) : the probability corresponding to the current node
	//
	// DMNP_MARGINAL_PROBABILITY (double) : the marginal probability corresponding to the current node
	//
	// DMNP_CAPTION	(BSTR) : the caption of the current node
	//
	// DMNP_SUPPORT	(double) : the support (number of cases) corresponding to the current node
	//
	// DMNP_MODEL_COLUMN_NAME (BSTR) : the "column name" corresponding to the current node
	//
	// DMNP_DESCRIPTION	(BSTR) : longer verion of the caption
	//
	// DMNP_SCORE (double) : the score of the node
	//
	// DMNP_SHORT_CAPTION (BSTR) : shorter version of the caption
	//
	//
	// For the string outputs, you need to allocate using the
	// appropriate methods of in_pContext.

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetNodeArrayProperty(
	/* [in] */ IDMContextServices*	in_pContext,
	/* [in] */ DM_NODE_PROP			in_PropID,
	/* [out] */ ULONG*				out_pulArraySize,
	/* [out] */ void**				out_prgArrayBuffer)
{
	// Same as above, except for "non simple" properties.

	// DMNP_ATTRIBUTES (DMVariantPtr* BSTR)	: a set of attribtues corresponding to the current node
	// DMNP_DISTRIBUTION (DM_ATTRIBUTE_STAT*) : the distribution corresponding to the 
	//											current node						
	
	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetNodeUniqueName(
	/* [in] */ IDMContextServices*	in_pContext,
	/* [out] */ DMString*			io_pstrUniqueName)
{
	// Return the unique string name of the current node

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetNodeIDFromUniqueName(
	/* [in] */ IDMContextServices*	in_pContext,
    /* [in] */ DMString*			in_pstrUniqueName,
    /* [out] */ DM_DAGNodeID*		out_pNodeID)
{
	// Translate from unique string name to node id

	return S_OK;
}

STDMETHODIMP YOUR_NAVIGATION_CLASS::GetUniqueNameFromNodeID( 
    /* [in] */ IDMContextServices*	in_pContext,
    /* [in] */ DM_DAGNodeID			in_NodeID,
    /* [out] */ DMString*			out_pstrUniqueName)
{
	// Translate from node id to unique string name

	return S_OK;
}

